#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# @Time : 2021/3/30 22:19 
# @Author : wenzi
# @File : manage.py 
# @Software: PyCharm
import sys
sys.path.append("..")
from flask_script import Manager, Server, Shell

from apiRestful import app
from extensions import db
from gevent import pywsgi

from models.user import User
from models.case import Cases
from models.report import Report

manager = Manager(app)


def make_shell_context():
    return dict(app=app, db=db, User=User)


# manager.add_command('runserver', Server(host='0.0.0.0', port=3389, use_debugger=False, use_reloader=True))
manager.add_command('runserver', pywsgi.WSGIServer(('0.0.0.0', 3389), app).serve_forever())
manager.add_command('shell', Shell(make_context=make_shell_context))

if __name__ == '__main__':
    manager.run(default_command='runserver')